Title Banner

Previous Book Contents Book Index Next

Inside Macintosh: QuickDraw GX Printing Extensions and Drivers /
Chapter 6 - Printing Resources / Printing Resources Reference
Resources Used Only in Printer Drivers


The Dialog Control ('dctl') Resource

You need to include a dialog control resource to define control items for the print dialog boxes used with Macintosh Printing Manager applications. This resource provides you with a means of mapping the behavior of items in an item list ('DITL') resource to fields in the universal print structure that QuickDraw GX uses for compatibility with Macintosh Printing Manager applications. The resource consists of a list of action types, each of which maps to one or more items in the item list resource and to a location in the universal print record.

The item list resource is described in Inside Macintosh: Macintosh Toolbox Essentials. The universal print structure is described in the section "The Universal Print Structure" beginning on page 4-12 in the chapter "Printing Messages." Figure 6-18 shows the structure of the dialog control resource.

Figure 6-18 The dialog control resource

The dialog control resource contains a count of the control-item entries and an array of control-item definitions.

Each control item definition has a unique item-key value and some number of values.

The types of control items that you can define in a dialog control resource are shown in Table 6-22. Each item is described in more detail in the sections that follow the table.
Table 6-22 Control item types
Item typeValueExplanation
Button1Implements the Cancel button
Cluster2Implements options that are presented to the user as a series of radio buttons
Copies3Implements the editable text item into which the user enters the number of copies to be printed
 
DialogBtn4Implements dialog boxes on top of the current dialog box
Frill5Used to draw the double-line bar, the version number, the heavy outline around the default button, and the printer name in the title of the dialog box
Moof6Draws Moof, the circus trick dog, which is displayed in the Page Setup dialog box to denote page orientation
OKButton7Implements the OK button
Orientation8Implements the orientation icon buttons
PageRange9Allows the user to specify the range of pages to be printed
PaperSizes10Implements selection of paper sizes by the user
Scale11Implements the print-scaling (Reduce/Enlarge) option
Toggle12Implements checkboxes that set and clear various bits in the iFlags field of the universal print structure

A dialog control resource can contain a number of actions, each of which is named by its type and followed by a number of values. Listing 6-17 shows two definitions of a dialog control resource from the ImageWriter II printer driver.

Listing 6-17 Two examples of a dialog control resource

resource 'dctl' (-8192, sysHeap, purgeable) {
   20,
   {
   Button { 2, cancel },
   Frill { 4, line },
   PaperSizes { 0, 0, { 6, 7, 8, 9, 10, 11 } },
   Orientation { 13, 14, 0, 0 },

   Toggle { 16, bPreciseBitmap },
   Toggle { 17, bUser0 },
   Toggle { 18, bBiggerPages },
   
   Frill { 19, version },
   Frill { 20, default },
   }
};
resource 'dctl' (-8191, sysHeap, purgeable) {
   21,
   {
   Button { 2, cancel },
   Frill { 4, line },
   Cluster { quality, { 6, 7, 8 } },
   PageRange { 10, 11, 12, 14},
   Copies { 16 },
   Cluster { feed, { 18, 19 } },
   
   Frill { 20, version },
   Frill { 21, default },
   }
};
The following sections describe the values that you need to specify in the dialog control resource for each item type.

Button Actions

You use the button (Button) action-item type to implement the Cancel button in the Print dialog box used with Macintosh Printing Manager applications. When the user selects this button, QuickDraw GX automatically restores the values in the universal print structure to what they were when the dialog box was created. This action uses two values:

Listing 6-17 on page 6-54 contains two examples of button actions.

Cluster Actions

You use the cluster (Cluster) action-item type to implement clusters of radio buttons. When the user selects one of the radio buttons, QuickDraw GX automatically updates the corresponding value in the universal print structure. This action uses two values:

Table 6-23 shows the constants that you can use to define what kind of item the radio button cluster is defining. Listing 6-17 contains an example of a cluster action.
Table 6-23 Cluster type constants for the dialog control resource
Cluster typeValueExplanation
feed0Defines the feed mode used for the print job by filling in the feed field in the universal print structure
quality1Defines the print-quality mode used by filling in the qualityMode field in the universal print structure
coverPage2Defines the type of cover page to print for the print job by filling in the coverPage field in the universal print structure
firstPage3Defines which of the printer's paper trays is used as the first paper tray for this print job by filling in the firstTray field in the universal print structure
restPage4Defines the other paper tray for this print job by filling in the remainingTray field in the universal print structure
headMotion5Defines the type of print-head motion to use for the print job by filling in the headMotion field in the universal print structure
createFile6Defines the type of file to save for this print job by filling in the saveFile field in the universal print structure
user07Reserved to allow the driver to define its own clusters and fill in the userCluster1 field in the universal print structure
user18Reserved to allow the driver to define its own clusters and fill in the userCluster2 field in the universal print structure
user29Reserved to allow the driver to define its own clusters and fill in the userCluster3 field in the universal print structure

Copies Actions

You use the copies (Copies) action-item type to implement the editable text item into which the user enters the desired number of print copies. When the user types a value into this field, QuickDraw GX verifies that the number is between 1 and 9999 and then stores that value in the actualCopies field in the universal print structure. This action uses one value:

Listing 6-17 on page 6-54 contains an example of the copies action type.

Dialog-Button Actions

You use the dialog-button (DialogBtn) action-item type to implement dialog boxes that appear on top of the current dialog box. For example, in the LaserWriter printer driver, the Options button in the style dialog box displays the dialog box with Moof in it on top of the style dialog box. When the user selects the item, QuickDraw GX brings up the specified dialog box, which can itself contain any of the action-item types in it. This action uses three values:

Frill Actions

You use the frill (Frill) action-item type to implement informational and decorative objects in the dialog box. This action uses two values:

Listing 6-17 on page 6-54 contains several examples of frill actions.

Moof Actions

You use the Moof (Moof) action-item type to display Moof, the circus trick dog, as is done when the orientation of the page is displayed in the Page Setup dialog box. This action uses one value:

Confirm-Button Actions

You use the confirm-button (OkButton) action-item type to implement the OK button in a dialog box. This item is only needed if there is a Create File cluster that needs to change the name of the OK button for printing (to switch the name of the OK button depending on whether the user is printing or saving a file). This action uses three values:

Orientation Actions

You use the orientation (Orientation) action-item type to implement the orientation icon buttons. You can use up to four different buttons to establish the value of the orientation field in the universal print structure. QuickDraw GX assumes that the driver contains as many icon ('ICON') resources as there are nonzero entries in this item definition. QuickDraw GX also assumes that the icon resource IDs start at 0 and increase by 1. This action uses four values:

Page-Range Actions

You use the page-range (PageRange) action-item type to implement the page-range selection. When the user enters page values in the "From" and "To" fields, QuickDraw GX updates the firstpage and lastPage values in the universal print structure. This action uses four values:

Listing 6-17 on page 6-54 contains an example of a page-range action in a dialog control resource.

Paper-Size Actions

You use the paper-size (PaperSizes) action-item type to implement selection of paper sizes for a print job. This action has two values and an array of item IDs:

Listing 6-17 on page 6-54 contains an example of a paper-size action item in a dialog control resource.

Scale Actions

You use the scale (Scale) action-item type to implement the reduce and enlarge option in the Page Setup dialog box. This action uses two values:

Toggle Actions

You use the toggle (Toggle) action-item type to implement the checkboxes that set and clear the flags in the options field of the universal print structure. This action uses
two values:

Listing 6-17 on page 6-54 contains several examples of toggle action items in a dialog control resource.


Previous Book Contents Book Index Next

© Apple Computer, Inc.
7 JUL 1996




Navigation graphic, see text links

Main | Page One | What's New | Apple Computer, Inc. | Find It | Contact Us | Help